package com.wzu.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wzu.entity.Policy;
import com.wzu.mapper.PolicyMapper;
import com.wzu.service.PolicyService;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class PolicyServiceImpl extends ServiceImpl<PolicyMapper, Policy> implements PolicyService {
    @Override
    public List<Policy> getAllPolicies() {
        return list();
    }
    @Override
    public Policy getPolicyByYear(String year) {
        QueryWrapper<Policy> wrapper = new QueryWrapper<>();
        wrapper.eq("year", year);
        return getOne(wrapper);
    }
    @Override
    public boolean addPolicy(Policy policy) {
        return save(policy);
    }
    @Override
    public boolean updatePolicy(Policy policy) {
        return updateById(policy);
    }
    @Override
    public boolean deletePolicy(Integer id) {
        return removeById(id);
    }
} 